/**
 * Created by charsen on 16/5/23.
 */
directives.directive('message', ["$rootScope", "tools", "$timeout", function ($rootScope, tools, $timeout) {
    return {
        restrict: 'AE',
        scope: {},
        replace: true,
        link: function (scope, element, attr) {
            scope.content = '';
            scope.shown = false;
            $rootScope.$on('MESSAGE_EV', function (e, content) {
                $timeout(function () {
                    scope.content = content;
                }, 0);
                $(element).animate({
                    top: '5px'
                });
                $timeout(function () {
                    $(element).animate({
                        top: '-100px'
                    });
                }, 2000);
            });
        },
        templateUrl: "/trend-new-BI/app/components/common/message/messageView.html"
    }
}]);